package com.kingmed.kmss.api.internal;

import com.kingmed.kmss.common.dto.kmcs.KmcsConsumablesDTO;
import com.kingmed.kmss.common.dto.kmcs.KmcsConsumablesQueryDTO;
import com.kingmed.kmss.common.vo.CommonPage;
import com.kingmed.kmss.common.vo.CommonResponse;
import com.kingmed.kmss.common.vo.CommonResponseHelper;
import com.kingmed.kmss.framework.feign.client.kmcs.PsFeignServiceFacade;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 仅用于内部，给前端提供的通用型接口，因此不写在各自微服务里
 * 此类接口不涉及权限注解！如果涉及要控制权限，必须写在对应的微服务controller层，并加上权限注解
 * 强制：只能调用framework-feign里的client，不允许添加任何业务逻辑，业务逻辑必须写在facade
 * </p>
 */
@RestController
@RequestMapping("/int/kmcs/ps")
@Api(tags = "crm使用-KMCS营销相关公共接口")
public class KmcsPsApiController {

    @Autowired
    private PsFeignServiceFacade psFeignServiceFacade;

    @ApiOperation("耗材信息列表查询（分页）")
    @PostMapping(value = "/consumables")
    public CommonResponse<CommonPage<KmcsConsumablesDTO>> consumables(@RequestBody KmcsConsumablesQueryDTO queryDTO) {
        return CommonResponseHelper.success(psFeignServiceFacade.consumablesOr(queryDTO));
    }

}
